package com.tlxch.server.teacher.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.tlxch.dto.TAlertdto;
import com.tlxch.mapper.TAlertMapper;
import com.tlxch.pojo.SStudent;
import com.tlxch.pojo.TAlert;
import com.tlxch.result.PageResult;
import com.tlxch.server.teacher.TAlertService;
import com.tlxch.vo.TAlertGradevo;
import com.tlxch.vo.TAlertvo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TAlertServiceImpl implements TAlertService {
    @Autowired
    TAlertMapper tAlertMapper;

    public PageResult pageQuery(TAlertdto tAlertdto) {
        PageHelper.startPage(tAlertdto.getPage(),tAlertdto.getPageSize());
        //下一条sql进行分页，自动加入limit关键字分页
        Page<TAlertvo> page = tAlertMapper.pageQuery(tAlertdto);
        return new PageResult(page.getTotal(), page.getResult());
    }

    public PageResult getStuGradeList(TAlertdto tAlertdto) {
        PageHelper.startPage(tAlertdto.getPage(),tAlertdto.getPageSize());
        //下一条sql进行分页，自动加入limit关键字分页
        Page<TAlertGradevo> page = tAlertMapper.getStuGradeList(tAlertdto);
        return new PageResult(page.getTotal(), page.getResult());
    }
}
